Skip to content

RTECO-858: Add JFrog CLI Task support for Bamboo Deployment Projects#231

Merged
naveenku-jfrog merged 3 commits into
masterfrom
RTECO-858
May 26, 2026
Merged

RTECO-858: Add JFrog CLI Task support for Bamboo Deployment Projects#231
naveenku-jfrog merged 3 commits into
masterfrom
RTECO-858

Conversation

@naveenku-jfrog
Copy link
Copy Markdown
Contributor

The JFrog CLI task was available in build plans but invisible in Deployment Project task pickers because it did not implement DeploymentTaskType.

Add a full deployment-project variant of the JFrog CLI task:

  • ArtifactoryDeploymentJfrogCliTask: extends ArtifactoryDeploymentTaskType (which implements DeploymentTaskType), runs any user-supplied jf command as a subprocess, injecting JF_URL / JF_USER / JF_PASSWORD from the selected server configuration so credentials never need to be embedded in the command.
  • JfrogCliDeploymentContext: config key constants and typed getters.
  • JfrogCliDeploymentConfiguration: task configurator for the create/edit UI.
  • editJfrogCliDeploymentTask.ftl: UI template with server dropdown and free-form command textarea.
  • atlassian-plugin.xml: registers the new taskType with category "deployment".
  • i18n-jfrog.properties: adds labels and help text for the new task.

The JFrog CLI task was available in build plans but invisible in Deployment
Project task pickers because it did not implement DeploymentTaskType.

Add a full deployment-project variant of the JFrog CLI task:
- ArtifactoryDeploymentJfrogCliTask: extends ArtifactoryDeploymentTaskType
  (which implements DeploymentTaskType), runs any user-supplied `jf` command
  as a subprocess, injecting JF_URL / JF_USER / JF_PASSWORD from the selected
  server configuration so credentials never need to be embedded in the command.
- JfrogCliDeploymentContext: config key constants and typed getters.
- JfrogCliDeploymentConfiguration: task configurator for the create/edit UI.
- editJfrogCliDeploymentTask.ftl: UI template with server dropdown and
  free-form command textarea.
- atlassian-plugin.xml: registers the new taskType with category "deployment".
- i18n-jfrog.properties: adds labels and help text for the new task.

Co-authored-by: Cursor <cursoragent@cursor.com>
@naveenku-jfrog naveenku-jfrog requested a review from agrasth May 26, 2026 10:08
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atlassian-plugin.xml registers two non-existent classes (ArtifactoryDeploymentPublishBuildInfoTask, ArtifactoryDeploymentXrayScanTask)

The diff includes registrations for these two task types, but neither class exists in this PR or anywhere in the codebase. This can cause the plugin to fail to load at startup in Bamboo.
These registrations appear to be leftover/accidental and should be removed (or the classes need to be added — but the PR description makes no mention of them).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed it.

Comment on lines +73 to +75
} catch (IOException | InterruptedException e) {
buildInfoLog.error("Exception while running JFrog CLI command: " + e.getMessage(), e);
return TaskResultBuilder.newBuilder(deploymentTaskContext).failedWithError().build();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InterruptedException swallowed without restoring interrupt status

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed it.

return StringUtils.trimToEmpty(env.get(JF_COMMAND));
}

public static Set<String> getFieldsToCopy() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getFieldsToCopy() allocates a new HashSet on every call.
Should be a static constant: private static final Set FIELDS_TO_COPY = Set.of(SERVER_ID, JF_COMMAND);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed it.

- atlassian-plugin.xml: remove leftover taskType registrations for
  ArtifactoryDeploymentPublishBuildInfoTask and ArtifactoryDeploymentXrayScanTask.
  Those classes are not part of this PR and would have caused the plugin to
  fail to load at startup in Bamboo.
- ArtifactoryDeploymentJfrogCliTask: split the catch block so InterruptedException
  restores the thread's interrupt status (Thread.currentThread().interrupt())
  before failing the task, instead of being silently swallowed.
- JfrogCliDeploymentContext: hoist the field-name set into a static final
  Set.of(...) constant so getFieldsToCopy() no longer allocates a new HashSet
  on every invocation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@naveenku-jfrog naveenku-jfrog requested a review from agrasth May 26, 2026 15:53
Expands the JFrog CLI deployment task work to also restore the
deployment-project variants of "Artifactory Publish Build Info" and
"Artifactory Xray Scan", which were previously only available in build
plans. The two task class registrations in atlassian-plugin.xml had no
corresponding Java implementations; this commit adds them.

- ArtifactoryDeploymentPublishBuildInfoTask: extends
  ArtifactoryDeploymentTaskType so it implements DeploymentTaskType and
  appears in the Deployment Project task picker. Publishes a minimal
  BuildInfo (name/number/started date) to Artifactory using the selected
  server configuration.
- ArtifactoryDeploymentXrayScanTask: deployment-project variant that
  triggers a JFrog Xray scan for a previously published build and fails
  the deployment when the scan reports vulnerabilities (when
  failIfVulnerable is set).
- ArtifactoryBuildContext: add getBuildName()/getBuildNumber() helpers
  that read directly from the configuration map. Required because a
  DeploymentTaskContext does not provide a BuildContext from which the
  build-time tasks normally pull these values.
- atlassian-plugin.xml: re-register the two task types alongside the
  JFrog CLI task. Both reuse their build-time variants' configuration
  classes and FTL templates, since the configuration shape is identical.

Co-authored-by: Cursor <cursoragent@cursor.com>
@naveenku-jfrog naveenku-jfrog merged commit 34ebeec into master May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants